package com.nbsaas.boot.product.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.util.Date;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "页面模板", model = "页面模板")
@Entity
@Table(name = "bs_page_template")
@Comment("页面模板表")
public class PageTemplate extends AbstractEntity {

    @Comment("模板名称")
    @SearchItem(name = "name", key = "name", label = "模板名称")
    @FormField(title = "模板名称", sortNum = "1", grid = true, required = true)
    @Column(length = 100, nullable = false)
    private String name;

    @Comment("模板编码")
    @SearchItem(name = "code", key = "code", label = "模板编码")
    @FormField(title = "模板编码", sortNum = "2", grid = true, required = true)
    @Column(length = 50, unique = true, nullable = false)
    private String code;

    @Comment("页面类型")
    @FormField(title = "页面类型", sortNum = "3", grid = true, type = InputType.select, required = true)
    @Column(length = 20, nullable = false)
    private String pageType; // HOME-首页, CATEGORY-分类页, PRODUCT-商品详情页, CUSTOM-自定义页面

    @Comment("模板描述")
    @FormField(title = "模板描述", sortNum = "4")
    @Column(length = 500)
    private String description;

    @Comment("模板缩略图")
    @FormField(title = "模板缩略图", sortNum = "5", type = InputType.image)
    @Column(length = 500)
    private String thumbnail;

    @Comment("模板状态")
    @FormField(title = "模板状态", sortNum = "6", grid = true, type = InputType.select)
    @Column(length = 20)
    private String status; // ACTIVE-启用, INACTIVE-禁用, DRAFT-草稿

    @Comment("是否默认模板")
    @FormField(title = "是否默认模板", sortNum = "7", grid = true, type = InputType.select)
    private Boolean isDefault;

    @Comment("排序")
    @FormField(title = "排序", sortNum = "8", grid = true, type = InputType.el_input_number, sort = true)
    private Integer sort;

    @Comment("版本号")
    @FormField(title = "版本号", sortNum = "9", grid = true)
    @Column(length = 20)
    private String version;

    @Comment("发布状态")
    @FormField(title = "发布状态", sortNum = "10", grid = true, type = InputType.select)
    @Column(length = 20)
    private String publishStatus; // PUBLISHED-已发布, UNPUBLISHED-未发布

    @Comment("发布时间")
    @FormField(title = "发布时间", sortNum = "11", type = InputType.date, grid = true)
    private Date publishTime;

    @Comment("模板配置JSON")
    @FormField(title = "模板配置", sortNum = "12", type = InputType.richText, col = 23)
    @Column(columnDefinition = "TEXT")
    private String config;
} 